<?

class FormProcessor {
	
	private $formName;
	private $form;
	
	function FormProcessor(){
		// Instantiate the HTML_QuickForm object
	  // $this->formName = $formName;		
	   
	}
	
	public function getHTMLForm($formName){
	   $this->formName = $formName;
	   $this->form = new HTML_QuickForm($this->formName);
	   eval("\$formHTML = \$this->".$this->formName."();");	  
	   return $this->form->toHtml();
	}
	
	public function & getForm($formName){
	   $this->formName = $formName;
	   $this->form = new HTML_QuickForm($this->formName);
	   eval("\$this->".$this->formName."();");
	}
	
	private function articleForm(){
	  $this->form = new HTML_QuickForm($this->formName);	
	  $this->form->setDefaults(array(
    		'title' => 'Title',
    		'description' => 'Description'
	   ));
      $this->form->addElement('header', null, 'Add/Edit article');
	  $this->form->addElement('text', 'title', 'Title:', array('size' => 50, 'maxlength' => 255));
	  //$this->form->addElement('submit', null, 'Save');
	  $this->form->addElement('submit', $this->getButtonName('submit'), 'Send');

	  
	  $this->form->applyFilter('title', 'trim');
	  $this->form->addRule('title', 'Enter title', 'required', null, 'client');
	  
	  return $this->form;
	}

}
?>